package com.compass.doctor.banner

import android.view.ViewGroup
import android.widget.ImageView
import androidx.appcompat.widget.AppCompatImageView
import com.compass.banner.base.BaseBannerAdapter
import com.compass.framework.glide.setUrl
import com.compass.framework.model.Doctor


/**
 * @desc   BannerAdapter
 */
class HomeBannerAdapter : BaseBannerAdapter<String, BannerImageHolder>() {

    override fun onCreateHolder(parent: ViewGroup, viewType: Int): BannerImageHolder {
        val imageView = AppCompatImageView(parent.context).apply {
            scaleType = ImageView.ScaleType.CENTER_CROP
            layoutParams =
                ViewGroup.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT
                )
        }.also {
//            ViewUtils.setClipViewCornerRadius(it, dpToPx(12))
        }
        return BannerImageHolder(imageView)
    }

    override fun onBindView(holder: BannerImageHolder, data: String, position: Int, pageSize: Int) {
        holder.imageView.setUrl(data)
    }
}